//
//  ArtTopDataModel.m
//  ArtOfLiving
//
//  Created by 王文晓 on 16/5/3.
//  Copyright © 2016年 刘虎. All rights reserved.
//

#import "ArtTopDataModel.h"

@implementation ArtTopDataModel

- (instancetype)init
{
    self = [super init];
    if (self) {
        _coverModel = [[ArtTopCover alloc] init];
        _playInfoSDModel = [[ArtTopPlayInfoModel alloc] init];
        _playInfoHDModel = [[ArtTopPlayInfoModel alloc] init];
        _consumptionModel = [[ArtTopConsumptionModel alloc] init];
        _authorModel = [[ArtTopAuthorModel alloc]init];

    }
    return self;
}



- (void) setValue:(id)value forUndefinedKey:(NSString *)key
{
    
    if ([key isEqualToString:@"id"])
    {
        self.ID = value;

    }
    if ([key isEqualToString:@"description"]) {
        self.descriptions = value;
           }
    
    if ([key isEqualToString:@"author"])
    {
        
        [self.authorModel setValuesForKeysWithDictionary:value];
    }
    
    if ([key isEqualToString:@"consumption"])
    {
        
        [self.consumptionModel setValuesForKeysWithDictionary:value];
    }
    
    if ([key isEqualToString:@"cover"])
    {
        
        [self.coverModel setValuesForKeysWithDictionary:value];
    }
    
    if ([key isEqualToString:@"playInfo"])//playInfo是个数组
    {
        NSArray *array = value;
        for (int i = 0; i<array.count; i++) {
            
            NSDictionary *dic = [array objectAtIndex:i];
            if (i == 0) {
                
                [self.playInfoSDModel setValuesForKeysWithDictionary:dic];
            }else{
                [self.playInfoSDModel setValuesForKeysWithDictionary:dic];
            }
        }
    }
}









@end
